#include "peopleitem.h"
#include "ui_peopleitem.h"

peopleitem::peopleitem(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::peopleitem)
{
    ui->setupUi(this);
    last_timer->start();
    connect(last_timer,&QTimer::timeout,this,[=](){
        if(Lastmeschange)
        {
            ui->lastmes->setText(Lastmes);
        }
        Lastmeschange=false;
    });
}

peopleitem::~peopleitem()
{
    delete ui;
}

void peopleitem::init(QString name,QString headimage,QString account,QString lastmes)
{
    Name=name;
    HeadImage=headimage;
    Account=account;
    Lastmes=lastmes;
    ui->name->setText(Name);
    ui->image->setPixmap(QPixmap(HeadImage));
    ui->image->setScaledContents(true);
    if(!Lastmes.isEmpty())
        ui->lastmes->setText(Lastmes);
}
